package com.leilei;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * @author lei
 * @create 2023-02-27 15:51
 * @desc 经纬度定位点基类
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class LocationBase<V> {

    /**
     * 根据自己业务需求，填充核心数据
     */
    private V coreData;

    /**
     * 经度 ex 104063037,
     */
    private Integer longitude;


    /**
     * 纬度 ex 30701011
     */
    private Integer latitude;
    //
    // /**
    //  * 定位点名称 调试时好用
    //  */
    // private String pointName;


    @Override
    public boolean equals(Object o) {
        if (o == null) {
            return false;
        }
        if (this == o) {
            return true;
        }
        if (!(o instanceof LocationBase)) {
            return false;
        }
        LocationBase<?> that = (LocationBase<?>) o;
        return Objects.equals(coreData, that.coreData) &&
                Objects.equals(longitude, that.longitude) &&
                Objects.equals(latitude, that.latitude);
    }

    @Override
    public int hashCode() {
        return Objects.hash(coreData, longitude, latitude);
    }
}
